package src.com.doit.demo06;

import java.util.*;
@SuppressWarnings("all")
public class Test_Poker {
    public static void main(String[] args) {
        Map<Integer,String> Poker = new HashMap<>();//记录扑克
        List<Integer>list = new ArrayList<>();//记录扑克索引

        String [] Colors = "♠-♥-♦-♣".split("-");
        String [] Numbers="2-A-K-Q-J-10-9-8-7-6-5-4-3".split("-");

        int num = 2;
        for (String number : Numbers) {
            for (String color : Colors) {
                String s = color+number;
                Poker.put(num,s);
                list.add(num);
                num++;
            }
        }
        Poker.put(0,"大😊");
        Poker.put(1,"小☺");
        list.add(0);
        list.add(1);

        //洗牌
        Collections.shuffle(list);

        //发牌
        Set<Integer>player1 = new TreeSet<>();
        Set<Integer>player2 = new TreeSet<>();
        Set<Integer>player3 = new TreeSet<>();
        Set<Integer>diPai = new TreeSet<>();
        for (int i = 0; i < list.size(); i++) {
            if(i>=51)
                diPai.add(list.get(i));
            else if(i%3==0)
                player1.add(list.get(i));
            else if(i%3==1)
                player2.add(list.get(i));
            else if(i%3==2)
                player3.add(list.get(i));
        }

        //看牌
        show("柳岩",player1,Poker);
        show("唐嫣",player2,Poker);
        show("赵露思",player3,Poker);
        show("底牌",diPai,Poker);
    }

    private static void show(String name,Set<Integer>player, Map<Integer, String> poker) {
        System.out.print(name+":");
        for (Integer key : player) {
            System.out.print(poker.get(key)+" ");//牌
        }
        System.out.println();
    }
}
